package 剑指offer;

/**
 * 不用加减乘除做加法
 * https://leetcode-cn.com/problems/bu-yong-jia-jian-cheng-chu-zuo-jia-fa-lcof/solution/mian-shi-ti-65-bu-yong-jia-jian-cheng-chu-zuo-ji-7/
 */
public class Offer65_JZ48 {
    public int add(int a, int b) {
        while(b != 0) {
            int c = (a&b) << 1;
            a ^= b;
            b = c;
        }
        return a;
    }
}
